import request from '@/utils/index'

//请求搜索导航分类信息
export interface categoryArr {
    categoryId:string
    categoryName:string
}
interface categoryModel {
    category:categoryArr[]
}
export const reqCategoryList = () => request.get<any,categoryModel>('/hotWordBillboardCategory')



//请求导航分类下列表
export interface rankArr {
    word: string,
    shift: number,
    score: number
}
export interface hotWordResultListModel {
    hotWordResultList: rankArr[]
}
export const reqRankList = (categoryId:number, size:number) => request.get<any,hotWordResultListModel>(`/hotWordBillboard/list/2.0?categoryId=${categoryId}&size=${size}`)



// 动态搜索
export interface albumResultListModel {
    category: string,
    highlightKeyword: string,
    id: number,
    imgPath: string,
    isNoCopyright: boolean
    is_paid: boolean
    keyword: string
    play: number
    tracks: number
    url: string
}
export interface queryResultModel {
    id: number,
    keyword: string
}
export interface dataModel {
    result:{
        albumResultList:albumResultListModel[],
        queryResultList:queryResultModel[]
    }
}

export const reqSearchActive = (kw:string) => request.get<any,resModel<dataModel>>(`/revision/suggest?kw=${kw}&paidFilter=true&scope=all`)





// 搜索列表
export interface searchDataModel {
    albumViews:{
        albums:albumInfoModel[],
        pageSize:number
    },
    userViews: {
        users:userInfoModel[],
        pageSize:number
    },
    trackViews:{
        tracks:trackInfoModel[],
        pageSize:number
    }
}
export interface albumInfoModel {
    albumInfo:{
        title: string,
        intro: string,
        nickname: string,
        tracks:number,
        play:number,
        cover_path: string,
        id:number
    }
}

export interface userInfoModel {
    userInfo:{
        nickname: string,
        smallPic: string,
        followers_counts: number,
        tracks_counts: number,
        pTtitle:string,
        uid:number
    },
    statCountInfo:{
        albumCount:number
    }
}
export interface trackInfoModel {
    trackInfo:{
        title: string,
        nickname: string,
        cover_path: string,
        count_play: number,
        duration:number,
        id:number
    }
}

export const reqSearchList = (kw:string) => request.get<any,resModel<searchDataModel>>(`/m-revision/page/search?kw=${kw}&core=all&page=1&rows=5`)







// 空搜索的经典推荐
export interface recommendModel {
    ret:number,
    context:{},
    data:{
        albumViews:{},
        recommendItems:recommendItemsModel[]
    }
}
export interface recommendItemsModel {
    id: number,
    albumInfo: {
        id: number,
        title:string,
        cover:string,
        recommendReason:string
    },
    statCountInfo: {
        id: number,
        playCount:number,
        trackCount:number,
    }

}


export const reqRecommend = (kw:string) => request.get<any,recommendModel>(`/m-revision/page/search?kw=${kw}&core=all&page=1&rows=5`)








// 专辑列表
export const reqAlbumList = (kw:string,page:number) => request.get<any,resModel<searchDataModel>>(`/m-revision/page/search?kw=${kw}&core=album&page=${page}&rows=20`)
// 声音列表
export const reqTrackList = (kw:string,page:number) => request.get<any,resModel<searchDataModel>>(`/m-revision/page/search?kw=${kw}&core=track&page=${page}&rows=20`)
// 主播列表
export const reqUserList = (kw:string,page:number) => request.get<any,resModel<searchDataModel>>(`/m-revision/page/search?kw=${kw}&core=user&page=${page}&rows=20`)